#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "ui_MainWindow.h"

#include "MapWindow.h"
#include "VRPDocument.h"

namespace Ui {
    class MainWindow;
}

enum {ColName = 0, ColDemand = 1,  ColCheck = 2};
enum {ColVehicle = 0, ColCost = 1,  ColCap = 2, ColDel = 3};

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void processVRPAction(QAction* vrpAction);
    void processMapInput(const QPointF coordinate);
    void processMapCirclePoint(CirclePointMapPtr point);
    void addCustomerToTable(CustomerPtr customer);
    void removeSelectedCustomers();
    void clearVRPDocument();
    void editCustomerAtTable(int row, int column);
    void showDocument();
    void addVehicle();
    void addVehicleToTable(VehiclePtr vehicle);

private:
    Ui::MainWindow *ui;
    QActionGroup* actionGroup;
    MapWindow* mapWindow;
    VRPDocument* vrpDocument;

    void initCommonUi();
    bool inputCustomerInfo(CustomerInfo& info);
    void removeCustomer(CustomerPtr customer);
};

class VehicleSpinBox: public QSpinBox
{
    Q_OBJECT

public:
    enum {CostSpin, CapacitySpin};

    VehicleSpinBox(VehiclePtr vehicle, int type, QWidget* parent = NULL);
    ~VehicleSpinBox();

private slots:
    void changeVehicle(int val);

private:
    VehiclePtr vehicle_;
    int type_;
};

#endif // MAINWINDOW_H
